package android.scanner.scan;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.scanner.scan.module.MainActivity;

/**
 * Created by lori.lin
 * on 15/1/20 下午4:26
 * usage:
 */
public class SplashActivity extends Activity {

    private final static int MESSAGE_DELAY = 1;

    Handler handler = new Handler()
    {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what)
            {
                case MESSAGE_DELAY:
                    startActivity(new Intent(SplashActivity.this,MainActivity.class));
                    SplashActivity.this.finish();
                    break;
            }
        }
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        new Thread(new Runnable() {
            @Override
            public void run() {
                handler.sendEmptyMessageDelayed(MESSAGE_DELAY, 2000);
            }
        }).start();
    }
}
